<?php
/**
 * Eaccelerator缓存类
 */
class EacceleratorCache extends CacheHelper
{

    /**
     * 架构函数
     * @access public
     */
    public function __construct($options='')
    {
        $this->type = 'Eaccelerator';
    }

    /**
     * 读取缓存
     * @access public
     * @param string $name 缓存变量名
     * @return mixed
     */
     public function get($name)
     {
		$this->Q(1);
        return eaccelerator_get($name);
     }


    /**
     * 写入缓存
     * @access public
     * @param string $name 缓存变量名
     * @param mixed $value  存储数据
     * @return boolen
     */
     public function set($name, $value, $ttl = null)
     {
		$this->W(1);
		$expire = (isset($ttl) && is_null($ttl)) ? $ttl : $this->expire;
        
        eaccelerator_lock($name);
        return eaccelerator_put($name, $value, $expire);
     }


    /**
     * 删除缓存
     * @access public
     * @param string $name 缓存变量名
     * @return boolen
     */
     public function delete($name)
     {
         return eaccelerator_rm($name);
     }

}
?>